package ink.lovejinhu.leetcodeMatch;

import java.math.BigInteger;

/**
 * @author jinhu
 * created 2021-07-04 10:39
 */
public class Solution_5802 {
    /**
     * 偶数位必须是偶数，奇数位是质数  2 3 5 7
     *
     * @param n
     * @return
     */
    public int countGoodNumbers(long n) {
        // BigInteger bigInteger = new BigInteger();
        if (n == 1) {
            return 5;
        }
        BigInteger res = new BigInteger("1");
        BigInteger oushu = new BigInteger("5");
        BigInteger qishu = new BigInteger("4");
        for (int i = 1; i < n; i++) {   //不包含第一位   //4*4*5*4
            if (i % 2 == 0) {
                res = res.multiply(oushu);
            } else {
                res = res.multiply(qishu);
            }
        }
     //   res = res.multiply(qishu);
        res = res.multiply(oushu);
        //  BigInteger divide = res.divide(new BigInteger("1000000007"));
        BigInteger[] result = res.divideAndRemainder(new BigInteger("1000000007"));
//        System.out.println("商是：" + result[0] +
//                "；余数是：" + result[1]) ;
        return result[1].intValue();
        //return new Integer(res.divideAndRemainder(new BigInteger("1000000007")).toString());
        // return new Integer(res.subtract(divide.multiply(new BigInteger("1000000007"))).toString());
    }

    public static void main(String[] args) {
        Solution_5802 solution_5802 = new Solution_5802();
        System.out.println(solution_5802.countGoodNumbers(50));
        //  System.out.println(solution_5802.countGoodNumbers(4));
    }
}
